package org.example.cloudalibaba.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.cloudalibaba.service.PaymentService;
import org.example.springcloud.common.Result;
import org.example.springcloud.entity.Payment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

// 使用openFeign的PaymentService
@Slf4j
@RestController
public class CircuitBreakerFeignController {
    @Resource
    private PaymentService paymentService;

    // 访问地址：http://localhost:8080/payment/get/1
    @GetMapping("/payment/get/{id}")
    public Result<Payment> paymentInfo(@PathVariable("id") Long id) {
        return paymentService.paymentInfo(id);
    }
}
